/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Quicksand', 'Arial', 'Microsoft YaHei', sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6a3093;
    --primary-gradient: linear-gradient(135deg, #6a3093 0%, #a044ff 100%);
    --secondary-color: #ff9a44;
    --secondary-gradient: linear-gradient(135deg, #ff9a44 0%, #fc6076 100%);
    --text-color: #333;
    --light-text: #fff;
    --dark-bg: #2c2c54;
    --light-bg: #f5f7fa;
    --card-bg: #ffffff;
    --shadow: 0 10px 20px rgba(106, 48, 147, 0.2);
    --hover-shadow: 0 15px 30px rgba(106, 48, 147, 0.3);
    --border-radius: 12px;
}

body {
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.6;
    background-image: url('../images/stardust.png');
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 40px 0;
    background: var(--primary-gradient);
    color: var(--light-text);
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/constellation.png');
    opacity: 0.1;
    z-index: 0;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header h1 i {
    margin-right: 15px;
    animation: float 3s ease-in-out infinite;
}

.subtitle {
    font-size: 1.3rem;
    font-style: italic;
    position: relative;
    z-index: 1;
    opacity: 0.9;
}

/* 游戏介绍部分 */
.game-intro {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.game-intro:hover {
    box-shadow: var(--hover-shadow);
    transform: translateY(-5px);
}

.game-intro::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background-image: url('../images/magic-wand.png');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.05;
    z-index: 0;
}

.game-intro h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    font-size: 1.8rem;
    position: relative;
}

.game-intro h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: var(--secondary-gradient);
}

.game-rules {
    background-color: rgba(106, 48, 147, 0.05);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    border-left: 4px solid var(--primary-color);
}

.game-rules h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.game-rules ol {
    padding-left: 25px;
}

.game-rules li {
    margin-bottom: 10px;
    position: relative;
}

.game-rules li::marker {
    color: var(--primary-color);
    font-weight: bold;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    justify-content: center;
    margin-top: 25px;
}

.special-btn {
    background: var(--secondary-gradient);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(252, 96, 118, 0.3);
}

.special-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(252, 96, 118, 0.4);
}

.special-btn:active {
    transform: translateY(1px);
}

.special-btn i {
    font-size: 1.2rem;
    animation: spin 4s linear infinite;
}

/* 游戏区域样式 */
.game-area {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    width: 100%;
    overflow-x: hidden; /* 防止水平滚动 */
}

.story-container {
    flex: 3;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.story-container:hover {
    box-shadow: var(--hover-shadow);
}

.story-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/paper-texture.png');
    opacity: 0.05;
    z-index: 0;
}

.story-container h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    font-size: 1.8rem;
    position: relative;
}

.story-container h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary-gradient);
}

#story-display {
    background-color: rgba(106, 48, 147, 0.03);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    min-height: 250px;
    max-height: 400px;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(106, 48, 147, 0.1);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.story-starter {
    font-style: italic;
    color: var(--primary-color);
    font-size: 1.2rem;
    line-height: 1.8;
    text-shadow: 0 0 1px rgba(106, 48, 147, 0.1);
    position: relative;
    padding-left: 20px;
}

.story-starter::before {
    content: '"';
    position: absolute;
    left: 0;
    top: 0;
    font-size: 2rem;
    color: rgba(106, 48, 147, 0.2);
    line-height: 1;
}

.story-starter::after {
    content: '"';
    font-size: 2rem;
    color: rgba(106, 48, 147, 0.2);
    line-height: 1;
    margin-left: 5px;
    vertical-align: bottom;
}

.story-segment {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed rgba(106, 48, 147, 0.2);
    position: relative;
}

.author-name {
    font-weight: bold;
    color: var(--primary-color);
    display: inline-block;
    margin-bottom: 5px;
    background: rgba(106, 48, 147, 0.05);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.story-input {
    position: relative;
    z-index: 10;
    width: 100%;
}

.story-input textarea {
    width: 100%;
    height: 180px;
    padding: 20px;
    border: 1px solid rgba(106, 48, 147, 0.2);
    border-radius: var(--border-radius);
    resize: none;
    font-size: 1.1rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03);
    pointer-events: auto !important;
    opacity: 1 !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    background-color: white !important;
    z-index: 100 !important;
    position: relative !important;
}

.story-input textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 48, 147, 0.1);
}

.story-input textarea::placeholder {
    color: rgba(106, 48, 147, 0.4);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#timer {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-color);
    background: rgba(106, 48, 147, 0.05);
    padding: 8px 15px;
    border-radius: 50px;
    display: inline-block;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(106, 48, 147, 0.2);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(106, 48, 147, 0.3);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#pass-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.2);
}

#pass-btn:hover {
    box-shadow: 0 8px 20px rgba(108, 117, 125, 0.3);
}

#pass-btn:disabled {
    background: #cccccc;
    box-shadow: none;
}

/* 参与者区域 */
.participants {
    flex: 1;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.participants:hover {
    box-shadow: var(--hover-shadow);
}

.participants h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    font-size: 1.5rem;
    position: relative;
}

.participants h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary-gradient);
}

#participant-list {
    list-style-type: none;
    margin-bottom: 25px;
    max-height: 300px;
    overflow-y: auto;
}

#participant-list li {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border-radius: 8px;
}

#participant-list li:hover {
    background-color: rgba(106, 48, 147, 0.03);
}

.current-participant {
    font-weight: bold;
    color: var(--primary-color);
    position: relative;
    background-color: rgba(106, 48, 147, 0.05) !important;
    border-left: 3px solid var(--primary-color);
}

.current-participant::before {
    content: "➤ ";
    color: var(--primary-color);
    margin-right: 5px;
}

.add-participant {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.add-participant input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid rgba(106, 48, 147, 0.2);
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.add-participant input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 48, 147, 0.1);
}

.add-participant input::placeholder {
    color: rgba(106, 48, 147, 0.4);
}

/* 投票部分 */
.voting-section, .results-section {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.voting-section:hover, .results-section:hover {
    box-shadow: var(--hover-shadow);
}

.voting-section h2, .results-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    font-size: 1.8rem;
    position: relative;
}

.voting-section h2::after, .results-section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary-gradient);
}

#voting-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.vote-card {
    border: 1px solid rgba(106, 48, 147, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fff;
    position: relative;
    overflow: hidden;
}

.vote-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 50px;
    background-image: url('../images/quill.png');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.05;
    z-index: 0;
}

.vote-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.vote-card.selected {
    border-color: var(--primary-color);
    background-color: rgba(106, 48, 147, 0.05);
    box-shadow: 0 5px 15px rgba(106, 48, 147, 0.1);
}

.vote-card.selected::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.8);
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.vote-card h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.vote-card p {
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
}

/* 结果部分 */
#voting-results {
    margin-bottom: 30px;
    background-color: rgba(106, 48, 147, 0.03);
    padding: 20px;
    border-radius: var(--border-radius);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.winner {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.winner::before {
    content: '🏆';
    font-size: 1.5rem;
}

.winning-segment {
    background-color: rgba(106, 48, 147, 0.05);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    border-left: 4px solid var(--primary-color);
}

.winning-segment p {
    font-style: italic;
    line-height: 1.8;
}

.final-story {
    background-color: rgba(106, 48, 147, 0.03);
    padding: 30px;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.final-story::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/paper-texture.png');
    opacity: 0.05;
    z-index: 0;
}

.final-story h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    position: relative;
}

#complete-story {
    margin-bottom: 30px;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

#complete-story p {
    margin-bottom: 15px;
    text-indent: 2em;
}

.story-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

#save-story {
    background: var(--secondary-gradient);
    box-shadow: 0 5px 15px rgba(252, 96, 118, 0.2);
}

#save-story:hover {
    box-shadow: 0 8px 20px rgba(252, 96, 118, 0.3);
}

/* 页脚 */
footer {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 0.9rem;
    margin-top: 50px;
    border-top: 1px solid rgba(106, 48, 147, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 20px 0;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .game-area {
        flex-direction: column;
    }
    
    .story-container, .participants {
        padding: 15px;
    }
    
    #story-display {
        padding: 15px;
        max-height: 300px;
    }
    
    .story-input textarea {
        height: 150px;
        padding: 15px;
        font-size: 1rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    #timer {
        margin-bottom: 15px;
        font-size: 1.2rem;
        text-align: center;
    }
    
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    button {
        width: 100%;
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    #voting-options {
        grid-template-columns: 1fr;
    }
    
    .vote-card {
        padding: 15px;
    }
    
    .story-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .add-participant {
        flex-direction: column;
    }
    
    .add-participant input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .add-participant button {
        width: 100%;
    }
    
    .game-intro, .voting-section, .results-section {
        padding: 20px;
    }
    
    .final-story {
        padding: 20px;
    }
}

/* 小型手机屏幕 */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .story-container h2, .participants h3, .game-intro h2, .voting-section h2, .results-section h2 {
        font-size: 1.5rem;
    }
    
    #story-display {
        min-height: 200px;
        max-height: 250px;
    }
    
    .story-input textarea {
        height: 120px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 计时器警告样式 */
.timer-warning {
    color: #dc3545 !important;
    animation: pulse 1s infinite;
    background: rgba(220, 53, 69, 0.1);
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* 故事片段进入动画 */
.story-segment {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 投票卡片悬停效果 */
.vote-card:hover {
    transform: translateY(-5px) scale(1.02);
}

/* 按钮点击效果 */
button:active {
    transform: scale(0.98);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(106, 48, 147, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(106, 48, 147, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(106, 48, 147, 0.3);
}
/* 添加魔法效果 */
.magic-star {
    position: absolute;
    font-size: 12px;
    animation: twinkle 2s infinite alternate;
    z-index: 1;
    opacity: 0.7;
}

@keyframes twinkle {
    0% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

/* 加载动画 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    animation: pulse 1s infinite;
}

.loading::before {
    content: '✨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 11;
    animation: spin 1s infinite linear;
}

/* 按钮脉冲效果 */
.button-pulse {
    animation: buttonPulse 0.3s ease-in-out;
}

@keyframes buttonPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 页面加载动画 */
body {
    opacity: 0;
    transition: opacity 0.5s ease;
    min-width: 320px; /* 设置最小宽度，防止内容过度挤压 */
}

body.page-loaded {
    opacity: 1;
}

/* 烟花效果 */
.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.firework {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    --hue: 120;
    background-color: hsl(var(--hue), 100%, 60%);
    box-shadow: 0 0 10px 2px hsl(var(--hue), 100%, 60%);
    animation: explode 1s forwards;
}

@keyframes explode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(30);
        opacity: 0;
    }
}

/* 页脚图标样式 */
.footer-icons {
    margin-top: 10px;
    font-size: 1.2rem;
    color: rgba(106, 48, 147, 0.3);
}

.footer-icons i {
    margin: 0 10px;
    animation: float 3s infinite ease-in-out;
}

.footer-icons i:nth-child(2) {
    animation-delay: 0.6s;
}

.footer-icons i:nth-child(3) {
    animation-delay: 1.2s;
}

.footer-icons i:nth-child(4) {
    animation-delay: 1.8s;
}

.footer-icons i:nth-child(5) {
    animation-delay: 2.4s;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 15px;
    width: 100%;
}

/* 部分描述文本样式 */
.section-desc {
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

/* 故事容器悬停效果 */
.story-container:hover::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background-image: radial-gradient(circle, rgba(106, 48, 147, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: moveGradient 5s infinite alternate ease-in-out;
}

@keyframes moveGradient {
    0% { top: 10%; right: 10%; }
    100% { top: 80%; right: 80%; }
}

/* 增强故事显示区域 */
#story-display {
    position: relative;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
        url('../images/paper-texture.png');
    background-size: cover;
    border: 1px solid rgba(106, 48, 147, 0.1);
    box-shadow: 
        inset 0 2px 10px rgba(0, 0, 0, 0.05),
        0 0 20px rgba(106, 48, 147, 0.05);
}

/* 增强投票卡片 */
.vote-card {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vote-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(106, 48, 147, 0.1);
}

/* 增强标题图标 */
h2 i, h3 i {
    margin-right: 10px;
    color: var(--primary-color);
}

/* 增强故事片段 */
.story-segment {
    position: relative;
    padding-left: 15px;
}

.story-segment:not(.story-starter)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(to bottom, rgba(106, 48, 147, 0.2), rgba(106, 48, 147, 0));
    border-radius: 3px;
}
